from selenium import webdriver
import os
import time
driver = webdriver.Firefox()
driver.get('https://www.baidu.com')
while 1:

    url = driver.current_url
    urls=url.split("/")
    print(urls[2])
    time.sleep(1)
    
    driver.execute_script("window.alert('这是一个alert弹框。');") 
    alert = driver.switch_to.alert
    time.sleep(10)
    alert.accept()
    if(urls[2]=="www.189.cn"):
        driver.close()
        exit()dfas  dsa assd 